﻿@model IEnumerable<vw08_equest.Areas.Administrator.Models.QuestionSelectResult>

<style type="text/css">
    .alert
    {
    	display:none;
    }
</style>

<script type="text/javascript">
    $(document).ready(function () {
        ShowArlert();
    });

    function ShowArlert() {
        var Error = '@ViewBag.Error';
        if (Error != '')
            $(".alert-error").show();
        var Success = '@ViewBag.Success';
        if (Success != '')
            $(".alert-success").show();
        var Warning = '@ViewBag.Warning';
        if (Warning != '')
            $(".alert-info").show();
    }
</script>

<div class="page-header">
    <div class="icon">
        <span class="ico-pen-2"></span>
    </div>
    <h1>
        Cập nhật câu hỏi <small>VWSOL METRO STYLE ADMIN PANEL</small></h1>
</div>

<div class="row-fluid">
    <div class="block">
        <div class="alert alert-error">            
            <strong>@ViewBag.Error</strong>
        </div>
        <div class="alert alert-success">            
            <strong>@ViewBag.Success</strong>
        </div>            
        <div class="alert alert-info">            
            <strong>@ViewBag.Warning</strong>
        </div>
        <div class="head">                                
            <h2>Thông tin câu hỏi</h2>
            <ul class="buttons">             
                <li><a href="javascript:void(0)"><div class="icon"><span class="ico-info"></span></div></a></li>
            </ul>                                  
        </div>
        @using (Html.BeginForm("EditQuestion", "AdminQuestion", FormMethod.Post, new { id = "validate", enctype = "multipart/form-data" }))
        {
            <div class="data-fluid">
                <div class="span9">
                    <div class="row-form">
                        <div class="span3">Câu hỏi:</div>
                        <div class="span9">
                            <input type="hidden" id="QuestionID" name="QuestionID" value="@Model.FirstOrDefault().QuestionID" />
                            <textarea id="Question" name="Question" class="validate[required]">@Model.FirstOrDefault().Question</textarea>
                        </div>
                    </div>
                    <div class="row-form">
                        <div class="span3">Độ khó</div>
                        <div class="span9">
                            <select name="Level" id="Level">
                                <option value="1" @(@Model.FirstOrDefault().QuestionLevel == 1 ? "selected" : "")>Câu hỏi dễ</option>
                                <option value="2" @(@Model.FirstOrDefault().QuestionLevel == 2 ? "selected" : "")>Câu hỏi trung bình</option>
                                <option value="3" @(@Model.FirstOrDefault().QuestionLevel == 3 ? "selected" : "")>Câu hỏi Khó</option>
                            </select>
                        </div>
                    </div>
                    @foreach (var item in Model)
                    {
                        <div class="row-form @(item.IsTrue == true ? "success" : "error")">
                            <div class="span3">@(item.IsTrue == true ? "Câu trả lời đúng" : "Câu trả lời")</div>
                            <div class="span9"><input name="@(item.IsTrue == true ? "TrueAnswer" : "FalseAnswer")" type="text" class="validate[required]" value="@item.Answer"/></div>
                        </div>
                    }
                    <div class="row-form">
                        <div class="span3">&nbsp;</div>
                        <div class="span9">
                            <button class="btn" type="submit">
                                <span class="icon-th icon-white"></span>
                                Cập nhật câu hỏi
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        }
    </div>
</div>

